package com.baoyouqun.service;

import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baoyouqun.domain.CreateCmd.UserPointsRecordCreateCmd;
import com.baoyouqun.domain.CreateCmd.UserPointsWriteOffCreateCmd;
import com.baoyouqun.domain.Query.UserPointsRecordQuery;
import com.baoyouqun.domain.UpdateCmd.UserPointsRecordUpdateCmd;
import com.baoyouqun.domain.UpdateCmd.UserPointsWriteOffUpdateCmd;
import com.baoyouqun.domain.VO.UserPointsRecordVO;
import com.baoyouqun.entity.UserPointsRecord;
import jakarta.servlet.http.HttpServletResponse;

public interface UserPointsRecordService extends IService<UserPointsRecord> {
    // 原有接口保留（不变）
    SingleResponse<UserPointsRecordVO> create(UserPointsRecordCreateCmd cmd);

    Response update(UserPointsRecordUpdateCmd cmd);

    UserPointsRecordVO selectById(String id);

    IPage<UserPointsRecordVO> pageVo(UserPointsRecordQuery query);

    // ---------------------- 新增核销相关接口 ----------------------

    /**
     * 1. 分页查询核销记录（仅查changeType=3，关联用户名）
     */
    IPage<UserPointsRecordVO> pageWriteOffVo(UserPointsRecordQuery query);

    /**
     * 2. 创建积分核销记录（扣减用户积分，事务保证）
     */
    SingleResponse<UserPointsRecordVO> createWriteOff(UserPointsWriteOffCreateCmd cmd);

    /**
     * 3. 编辑积分核销记录（调整积分扣减，事务保证）
     */
    Response updateWriteOff(UserPointsWriteOffUpdateCmd cmd);

    /**
     * 4. 删除积分核销记录（恢复用户积分，事务保证）
     */
    Response deleteWriteOff(String id);

    /**
     * 5. 导出核销记录Excel（按筛选条件全量导出）
     */
    void exportWriteOffExcel(UserPointsRecordQuery query, HttpServletResponse response);
}